package com.yaoli.ajob;

/**
 * Created by will on 2017/4/21.
 */
public class _303_RangeSumQueryImmutable {
    public static void main(String[] args) {
        int i1 = Integer.bitCount(2);
        int x = Integer.valueOf("1000",2);
        System.out.println(x);
    }

    int dp [];

    public _303_RangeSumQueryImmutable(int[] nums) {
        int i1 = Integer.bitCount(2);
        int x = Integer.valueOf("1111",10);
        System.out.println(x);
        dp = new int[nums.length+1];
        for(int i = 0 ; i < nums.length; i ++){
            dp[i + 1] = dp [i] + nums[i];
        }
    }

    public int sumRange(int i, int j) {
        return dp[j+1] - dp[i];

    }
}
